<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" :fullscreen="allscreen">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
          <el-divider content-position="left">参保人信息</el-divider>
          <el-row>
            <el-col :span="8">
              <el-form-item label="证件类型" prop="certType">
                <el-select v-model="form.certType" filterable placeholder="请选择" style="width: 370px;">
                  <el-option
                    v-for="item in dict.zjlx"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="证件号码" prop="certno">
                <el-input v-model="form.certno" style="width: 370px;">
                  <el-button slot="append" icon="el-icon-search" title="查找患者信息" @click="getSnry" />
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="人员姓名" prop="psnName">
                <el-input v-model="form.psnName" style="width: 370px;" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="医保区划">
                <el-select v-model="form.insuAdmdvs" filterable placeholder="请选择" style="width: 370px;">
                  <el-option
                    v-for="item in dict.ccstcqh"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="联系电话" prop="tel">
                <el-input v-model="form.tel" style="width: 370px;" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="异地居住标志" prop="outLiveFlag">
                <el-select v-model="form.outLiveFlag" filterable placeholder="请选择" style="width: 370px;">
                  <el-option
                    v-for="item in dict.PRIC_OUT_LIVE_FLAG"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="居住地行政区" prop="liveLocAdmdvs">
                <el-select v-model="form.liveLocAdmdvs" filterable placeholder="请选择" style="width: 370px;">
                  <el-option
                    v-for="item in dict.ccs"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="居住地址" prop="liveAddr">
                <el-input v-model="form.liveAddr" style="width: 370px;" />
              </el-form-item>
            </el-col>
            <el-col :span="8" />
          </el-row>
          <el-divider content-position="left">待遇登记信息</el-divider>
          <el-row>
            <el-col :span="8">
              <el-form-item label="失能等级">
                <el-select v-model="form.longtermEvalLv" filterable placeholder="请选择" style="width: 370px;">
                  <el-option
                    v-for="item in dict.PRIC_LONGTERM_EVAL_LV"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="待遇开始时间" prop="begntime">
                <el-date-picker v-model="form.begntime" type="date" value-format="yyyy-MM-dd" format="yyyy-MM-dd" style="width: 370px;" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="床位" prop="bedno">
                <el-input v-model="form.bedno" style="width: 370px;">
                  <el-button slot="append" icon="el-icon-search" title="查找床位" @click="getBed" />
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="护理员" prop="supMedstffName">
                <el-input v-model="form.supMedstffName" style="width: 370px;">
                  <el-button slot="append" icon="el-icon-search" title="查找护理员" @click="getHly" />
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8" />
            <el-col :span="8" />
          </el-row>
          <el-divider content-position="left">协议上传</el-divider>
          <el-divider content-position="left">银行卡信息</el-divider>
          <el-row>
            <el-col :span="8">
              <el-form-item label="银行大类" prop="bankTypeCode">
                <el-select v-model="form.bankTypeCode" filterable placeholder="请选择" style="width: 370px;">
                  <el-option
                    v-for="item in dict.PRIC_BANK_TYPE_CODE"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="开户银行名称">
                <el-input v-model="form.bankName" style="width: 370px;">
                  <el-button slot="append" icon="el-icon-search" title="查找银行信息" @click="getBanks" />
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="银行账号" prop="bankacct">
                <el-input v-model="form.bankacct" style="width: 370px;" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="银行户名" prop="bankAcctname">
                <el-input v-model="form.bankAcctname" style="width: 370px;" />
              </el-form-item>
            </el-col>
            <el-col :span="8" />
            <el-col :span="8" />
          </el-row>
          <el-divider content-position="left">代办人信息</el-divider>
          <el-row>
            <el-col :span="8">
              <el-form-item label="与参保人关系" prop="agnterRlts">
                <el-select v-model="form.agnterRlts" filterable placeholder="请选择" style="width: 370px;">
                  <el-option
                    v-for="item in dict.PRIC_PATN_RLTS"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="姓名" prop="agnterName">
                <el-input v-model="form.agnterName" style="width: 370px;" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="证件类型" prop="agnterCertType">
                <el-select v-model="form.agnterCertType" filterable placeholder="请选择" style="width: 370px;">
                  <el-option
                    v-for="item in dict.zjlx"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="证件号码" prop="agnterCertno">
                <el-input v-model="form.agnterCertno" style="width: 370px;" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="性别" prop="agnterGend">
                <el-select v-model="form.agnterGend" filterable placeholder="请选择" style="width: 370px;">
                  <el-option
                    v-for="item in dict.PRIC_GEND"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="联系电话" prop="agnterTel">
                <el-input v-model="form.agnterTel" style="width: 370px;" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="居住地行政区" prop="agnterLiveLocAdmdvs">
                <el-select v-model="form.agnterLiveLocAdmdvs" filterable placeholder="请选择" style="width: 370px;">
                  <el-option
                    v-for="item in dict.ccs"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="居住地址" prop="agnterLiveAddr">
                <el-input v-model="form.agnterLiveAddr" style="width: 370px;" />
              </el-form-item>
            </el-col>
            <el-col :span="8" />
          </el-row>

        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="psnName" label="参保人姓名" />
        <el-table-column prop="gend" label="参保人性别" />
        <el-table-column prop="certType" label="参保人证件类型" />
        <el-table-column prop="certno" label="参保人证件号码" />
        <el-table-column prop="brdy" label="参保人出生日期" />
        <el-table-column prop="insuAdmdvs" label="参保人所属医保区划" />
        <el-table-column prop="nurscareWay" label="护理方式" />
        <el-table-column prop="longtermEvalLv" label="失能评估等级" />
        <el-table-column prop="nurscareOrgName" label="护理机构名称" />
        <el-table-column prop="supMedstffName" label="主管护理员姓名" />
        <el-table-column prop="begntime" label="开始时间" />
        <el-table-column v-if="checkPer(['admin','pricRgst:edit','pricRgst:del'])" label="操作" width="200px" align="center">
          <template slot-scope="scope">
            <el-button type="primary" @click="openCostDetl(scope.row)">记账</el-button>
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
      <!--患者信息-->
      <el-drawer
        title="患者信息"
        :visible.sync="snryDrawer"
        direction="rtl"
        size="60%"
      >

        <div v-if="true" style="margin-left: 20px;">
          <!-- 搜索 -->
          <el-radio-group v-model="radio4" size="mini" class="filter-item">
            <el-radio-button label="ReadCardBas" name="医保卡">医保卡</el-radio-button>
            <el-radio-button label="ReadSFZ" name="身份证">身份证</el-radio-button>
          </el-radio-group>
          <!--          <el-button class="filter-item" size="mini" type="primary" icon="el-icon-bank-card" v-loading.fullscreen.lock="fullscreenLoading" @click="read">读 卡</el-button>-->
        </div>
        <div style="margin-left: 20px;">
          <!-- 搜索 -->
          <el-input v-model="ybrySfzh" clearable size="small" placeholder="输入身份证号" disabled style="width: 200px;" class="filter-item" @keyup.enter.native="ybryQuery" />
          <el-button v-loading.fullscreen.lock="fullscreenLoading" class="filter-item" size="mini" type="success" icon="el-icon-search" :loading="snryDataloading" @click="read">读卡搜索</el-button>
          <el-button v-if="false" class="filter-item" size="mini" type="success" icon="el-icon-search" :loading="snryDataloading" @click="ybryQuery">搜索</el-button>
        </div>
        <el-table ref="snrytable" v-loading="snryDataloading" :data="snryData">
          <el-table-column type="index" :index="indexMethod" label="序号" align="center" />
          <el-table-column prop="psn_name" label="姓名" align="center" />
          <el-table-column prop="psn_cert_type" label="人员证件类型" align="center" width="100px">
            <template slot-scope="scope">
              {{ dict.label.zjlx[scope.row.psn_cert_type] }}
            </template>
          </el-table-column>
          <el-table-column prop="certno" label="证件号码" align="center" width="150px" />
          <el-table-column prop="gend" label="性别" align="center">
            <template slot-scope="scope">
              {{ dict.label.PRIC_GEND[scope.row.gend] }}
            </template>
          </el-table-column>
          <el-table-column prop="brdy" label="出生日期" align="center" width="100px" />
          <el-table-column prop="age" label="年龄" align="center" width="100px" />
          <el-table-column prop="insuplc_admdvs" label="参保统筹区" align="center">
            <template slot-scope="scope">
              {{ dict.label.ccstcqh[scope.row.insuplc_admdvs] }}
            </template>
          </el-table-column>
          <el-table-column prop="insutype" label="险种" align="center" width="100px">
            <template slot-scope="scope">
              {{ dict.label.PRIC_INSUTYPE[scope.row.insutype] }}
            </template>
          </el-table-column>
          <el-table-column prop="psn_insu_stas" label="参保状态" align="center" width="100px">
            <template slot-scope="scope">
              {{ dict.label.PRIC_PSN_INSU_STAS[scope.row.psn_insu_stas] }}
            </template>
          </el-table-column>
          <el-table-column prop="psn_type" label="人员类型" align="center" width="100px">
            <template slot-scope="scope">
              {{ dict.label.PRIC_PSN_TYPE[scope.row.psn_type] }}
            </template>
          </el-table-column>
          <el-table-column
            fixed="right"
            label="操作"
            width="120"
          >
            <template slot-scope="scope">
              <el-button
                type="text"
                size="small"
                @click.native.prevent="selectRow(scope.row)"
              >
                确定
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-drawer>
      <!--银行信息-->
      <el-drawer
        title="银行信息"
        :visible.sync="bankDrawer"
        direction="rtl"
        size="60%"
      >
        <div style="margin-left: 20px;">
          <!-- 搜索 -->
          <el-input v-model="bank_abbr" clearable size="small" placeholder="输入银行名称" style="width: 200px;" class="filter-item" @keyup.enter.native="bankQuery" />
          <el-button class="filter-item" size="mini" type="success" icon="el-icon-search" :loading="bankDataloading" @click="bankQuery">搜索</el-button>
        </div>
        <el-table ref="banktable" v-loading="bankDataloading" :data="bankData">
          <el-table-column type="index" :index="indexMethod" label="序号" align="center" />
          <el-table-column prop="bank_abbr" label="银行名称" align="center" />
          <el-table-column prop="addr_prov" label="省" align="center" />
          <el-table-column prop="addr_city_coty" label="市、县" align="center" />
          <el-table-column
            fixed="right"
            label="操作"
            width="120"
          >
            <template slot-scope="scope">
              <el-button
                type="text"
                size="small"
                @click.native.prevent="selectBankRow(scope.row)"
              >
                确定
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-drawer>
      <!--床位信息-->
      <el-drawer
        title="床位信息"
        :visible.sync="bedDrawer"
        direction="rtl"
        size="60%"
      >
        <el-table ref="bedtable" v-loading="bedDataloading" :data="bedData">
          <el-table-column type="index" :index="indexMethod" label="序号" align="center" />
          <el-table-column prop="nurscareRegnName" label="照护区名称" />
          <el-table-column prop="roomNo" label="房间号" />
          <el-table-column prop="roomName" label="房间名称" />
          <el-table-column prop="bedNo" label="床位号" />
          <el-table-column prop="bedName" label="床位名称" />
          <el-table-column
            fixed="right"
            label="操作"
            width="120"
          >
            <template slot-scope="scope">
              <el-button
                type="text"
                size="small"
                @click.native.prevent="selectBedRow(scope.row)"
              >
                确定
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-drawer>
      <!--护理员信息-->
      <el-drawer
        title="护理员信息"
        :visible.sync="hlyDrawer"
        direction="rtl"
        size="60%"
      >
        <el-table ref="hlytable" v-loading="hlyDataloading" :data="hlyData">
          <el-table-column type="index" :index="indexMethod" label="序号" align="center" />
          <el-table-column prop="nurscarePsnNo" label="护理人员编号" />
          <el-table-column prop="nurscarePsnName" label="护理人员姓名" />
          <el-table-column
            fixed="right"
            label="操作"
            width="120"
          >
            <template slot-scope="scope">
              <el-button
                type="text"
                size="small"
                @click.native.prevent="selectHlyRow(scope.row)"
              >
                确定
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-drawer>
      <!-- 住院记账页面 -->
      <costDetl ref="costDetl" />
    </div>
  </div>
</template>

<script>
import crudPricRgstIns from '@/api/business/pricRgstIns'
import crudPricBed from '@/api/business/pricBed'
import crudPricPsn from '@/api/business/pricPsn'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import axios from 'axios'
import costDetl from '../costDetl/index'

const defaultForm = { pricRgstInsId: null, longtermRegId: null, longtermTrtAppyId: null, longtermEvalTaskId: null, psnNo: null, psnName: null, gend: null, certType: null, certno: null, brdy: null, insutype: null, insuAdmdvs: null, longtermEvalLv: null, nurscareOrgNo: null, nurscareOrgName: null, supMedstffNo: null, supMedstffName: null, nurscareWay: null, trtFlag: null, begntime: null, disecode: null, disename: null, deptName: null, nurscareRegn: null, bedno: null, year: null, fixBlngAdmdvs: null, longtermOrgNurscareRegnId: null, longtermOrgBedId: null, relsMedstffNo: null, relsMedstffName: null, bankTypeCode: null, bankId: null, bankName: null, bankacct: null, bankAcctname: null, outLiveFlag: null, naty: null, admdvs: null, natRegnCode: null, resdLocAdmdvs: null, resdAddr: null, liveLocAdmdvs: null, liveAddr: null, insuIdet: null, tel: null, lnt: null, lat: null, fstAppyFlag: null, lastAppyFlag: null, longtermEvalWay: null, evalLocAdmdvs: null, evalAddr: null, nurscareOrgLocAdmdvs: null, nurscareOrgAddr: null, servLocAdmdvs: null, servPath: null, crtNurscareWay: null, diseDscr: null, acpStas: null, trtAcpOpnn: null, undoReaCodg: null, undoReaDscr: null, trtAppySouc: null, infoSbmtTime: null, appyDate: null, evalCclsValiEnddate: null, selfEvalLv: null, scaleAnsrRsltId: null, longtermAgnterId: null, agnterName: null, agnterCertType: null, agnterCertno: null, agnterRlts: null, agnterGend: null, agnterTel: null, agnterLiveLocAdmdvs: null, agnterLiveAddr: null, bindFlag: null, optDotId: null, dataVer: null }
export default {
  name: 'PricRgstIns',
  components: { pagination, crudOperation, udOperation, costDetl },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  dicts: ['PRIC_OUT_LIVE_FLAG', 'zjlx', 'PRIC_GEND', 'ccstcqh', 'ccs', 'PRIC_LONGTERM_EVAL_LV', 'PRIC_BANK_TYPE_CODE', 'PRIC_PATN_RLTS', 'PRIC_INSUTYPE', 'PRIC_PSN_TYPE', 'PRIC_PSN_INSU_STAS'],
  cruds() {
    return CRUD({ title: '长护登记信息', url: 'api/pricRgst', idField: 'pricRgstInsId', sort: 'pricRgstInsId,desc', crudMethod: { ...crudPricRgstIns }})
  },
  data() {
    return {
      snryDrawer: false,
      bankDrawer: false,
      bedDrawer: false,
      hlyDrawer: false,
      radio4: 'ReadCardBas',
      ybrySfzh: '',
      bank_abbr: '',
      allscreen: true,
      fullscreenLoading: false,
      snryDataloading: false,
      bankDataloading: false,
      bedDataloading: false,
      hlyDataloading: false,
      snryData: [],
      bankData: [],
      bedData: [],
      hlyData: [],
      districts: [],
      psns: [],
      permission: {
        add: ['admin', 'pricRgst:add'],
        edit: ['admin', 'pricRgst:edit'],
        del: ['admin', 'pricRgst:del']
      },
      rules: {
        pricRgstInsId: [
          { required: true, message: '主键ID不能为空', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    queryAllPsn() {
      crudPricPsn.getAllPsns().then(res => {
        console.log('res: {} ', res)
        var a = []
        for (const item of res) {
          item.label = item.nurscarePsnName
          item.value = item.nurscarePsnNo
          for (const child of item.children) {
            child.label = child.nurscarePsnName
            child.value = child.nurscarePsnNo
          }
          a.push(item)
        }
        this.psns = a
      })
    },
    onchange(e) {
      console.log('选择的区/县街道:{}', e)
      this.form.liveLocAdmdvs = e[0]
    },
    agnterOnchange(e) {
      this.form.agnterLiveLocAdmdvs = e[0]
    },
    /**
     * 序号
     * @param index
     * @returns {*}
     */
    indexMethod(index) {
      return index + 1
    },
    getHly() {
      this.hlyDrawer = true
      this.hlyData = []
      this.hlyQuery()
    },
    hlyQuery() {
      this.hlyDataloading = true
      crudPricPsn.getAllPsns().then(res => {
        console.log('hlyQuery:', res)
        this.hlyData = res.content
        this.hlyDataloading = false
      }).catch(err => {
        this.hlyDataloading = false
        console.log(err.data.message)
      })
    },
    selectHlyRow(row) {
      console.log('selectHlyRow:', row)
      this.form.supMedstffNo = row.nurscarePsnNo
      this.form.supMedstffName = row.nurscarePsnName
      this.hlyDrawer = false
    },
    getBed() {
      this.bedDrawer = true
      this.bedData = []
      this.bedQuery()
    },
    bedQuery() {
      this.bedDataloading = true
      crudPricBed.getAllBeds().then(res => {
        console.log('bedQuery:', res)
        this.bedData = res.content
        this.bedDataloading = false
      }).catch(err => {
        this.bedDataloading = false
        console.log(err.data.message)
      })
    },
    selectBedRow(row) {
      console.log('selectBedRow:', row)
      this.form.bedno = row.bedNo
      this.form.longtermOrgBedId = row.longtermOrgBedId
      this.form.longtermOrgNurscareRegnId = row.longtermOrgNurscareRegnId
      this.form.nurscareRegn = row.nurscareRegnName
      this.bedDrawer = false
    },
    /**
     * 打开失能人员时，实时查询
     */
    getBanks() {
      this.bankDrawer = true
      this.bank_abbr = ''
      this.bankData = []
    },
    /**
     * 查询医保人员
     */
    bankQuery() {
      if (this.bank_abbr === '') {
        this.$message({
          showClose: true,
          message: '请输入查询条件',
          type: 'warning'
        })
        return
      }

      this.bankDataloading = true
      crudPricRgstIns.getBanks({ bank_type_code: this.form.bankTypeCode, bank_abbr: this.bank_abbr }).then(res => {
        console.log('bankQuery:', res)
        this.bankData = res.content
        this.bankDataloading = false
      }).catch(err => {
        this.bankDataloading = false
        console.log(err.data.message)
      })
    },
    selectBankRow(row) {
      console.log('selectBankRow:', row)
      this.form.bankId = row.bank_id
      this.form.bankName = row.bank_abbr
      this.bankDrawer = false
    },
    /**
     * 打开失能人员时，实时查询
     */
    getSnry() {
      this.snryDrawer = true
      this.ybrySfzh = ''
      this.snryData = []
    },
    /**
     * 查询医保人员
     */
    ybryQuery() {
      if (this.ybrySfzh === '') {
        this.$message({
          showClose: true,
          message: '请输入查询条件',
          type: 'warning'
        })
        return
      }

      this.snryDataloading = true
      crudPricRgstIns.getPersonnelInfo({ sfz: this.ybrySfzh }).then(res => {
        console.log('ybryQuery:', res)
        this.snryData = res.content
        this.snryDataloading = false
      }).catch(err => {
        this.snryDataloading = false
        console.log(err.data.message)
      })
    },
    /**
     * 确认选择的失能人员
     * @param index
     * @param rows
     */
    selectRow(row) {
      console.log('selectRow:', row)
      console.log('sfz:', row.certno)
      console.log('xm:', row.psn_name)
      console.log('rybm:', row.psn_no)
      console.log('zjlx:', row.psn_cert_type)
      console.log('tcq:', row.insuplc_admdvs)
      this.fullscreenLoading = true
      crudPricRgstIns.getRgstInfo({ sfz: row.certno, xm: row.psn_name, rybm: row.psn_no, zjlx: row.psn_cert_type, tcq: row.insuplc_admdvs }).then(res => {
        console.log('selectRow:', res)
        console.log('selectRow longterm_reg_ins_d_t_o:', res.longterm_reg_ins_d_t_o)
        console.log('selectRow trt_appy_ins_d_t_o:', res.trt_appy_ins_d_t_o)

        this.form.longtermTrtAppyId = res.longterm_reg_ins_d_t_o.longterm_trt_appy_id
        this.form.longtermEvalTaskId = res.longterm_reg_ins_d_t_o.longterm_eval_task_id
        this.form.psnNo = res.longterm_reg_ins_d_t_o.psn_no
        this.form.psnName = res.longterm_reg_ins_d_t_o.psn_name
        this.form.gend = res.longterm_reg_ins_d_t_o.gend
        this.form.certType = res.longterm_reg_ins_d_t_o.cert_type
        this.form.certno = res.longterm_reg_ins_d_t_o.certno
        this.form.insutype = res.longterm_reg_ins_d_t_o.insutype
        this.form.insuAdmdvs = res.longterm_reg_ins_d_t_o.admdvs
        this.form.longtermEvalLv = res.longterm_reg_ins_d_t_o.longterm_eval_lv
        this.form.outLiveFlag = res.longterm_reg_ins_d_t_o.out_live_flag

        this.form.liveLocAdmdvs = res.trt_appy_ins_d_t_o.live_loc_admdvs
        this.form.liveAddr = res.trt_appy_ins_d_t_o.live_addr
        this.form.brdy = res.trt_appy_ins_d_t_o.brdy
        this.form.tel = res.trt_appy_ins_d_t_o.tel
        this.form.naty = res.trt_appy_ins_d_t_o.naty
        this.form.insuIdet = res.trt_appy_ins_d_t_o.insu_idet

        this.form.longtermEvalWay = res.trt_appy_ins_d_t_o.longterm_eval_way
        this.form.fstAppyFlag = res.trt_appy_ins_d_t_o.fst_appy_flag
        this.form.evalLocAdmdvs = res.trt_appy_ins_d_t_o.eval_loc_admdvs
        this.form.evalAddr = res.trt_appy_ins_d_t_o.eval_addr
        this.form.agnterCertType = res.trt_appy_ins_d_t_o.agnter_cert_type
        this.form.agnterCertno = res.trt_appy_ins_d_t_o.agnter_certno
        this.form.agnterGend = res.trt_appy_ins_d_t_o.agnter_gend
        this.form.agnterLiveAddr = res.trt_appy_ins_d_t_o.agnter_live_addr
        this.form.agnterLiveLocAdmdvs = res.trt_appy_ins_d_t_o.agnter_live_loc_admdvs
        this.form.agnterName = res.trt_appy_ins_d_t_o.agnter_name
        this.form.agnterRlts = res.trt_appy_ins_d_t_o.agnter_rlts
        this.form.agnterTel = res.trt_appy_ins_d_t_o.agnter_tel

        this.form.acpStas = res.trt_appy_ins_d_t_o.acp_stas
        this.form.appyDate = res.trt_appy_ins_d_t_o.appy_date
        this.form.bindFlag = res.trt_appy_ins_d_t_o.bind_flag
        this.form.crtNurscareWay = res.trt_appy_ins_d_t_o.crt_nurscare_way
        this.form.evalCclsValiEnddate = res.trt_appy_ins_d_t_o.eval_ccls_vali_enddate
        this.form.infoSbmtTime = res.trt_appy_ins_d_t_o.info_sbmt_time
        this.form.lastAppyFlag = res.trt_appy_ins_d_t_o.last_appy_flag
        this.form.longtermAgnterId = res.trt_appy_ins_d_t_o.longterm_agnter_id
        this.form.natRegnCode = res.trt_appy_ins_d_t_o.nat_regn_code
        this.form.resdAddr = res.trt_appy_ins_d_t_o.resd_addr
        this.form.resdLocAdmdvs = res.trt_appy_ins_d_t_o.resd_loc_admdvs
        this.form.scaleAnsrRsltId = res.trt_appy_ins_d_t_o.scale_ansr_rslt_id
        this.form.selfEvalLv = res.trt_appy_ins_d_t_o.self_eval_lv
        this.form.servLocAdmdvs = res.trt_appy_ins_d_t_o.serv_loc_admdvs
        this.form.servPath = res.trt_appy_ins_d_t_o.serv_path
        this.form.trtAcpOpnn = res.trt_appy_ins_d_t_o.trt_acp_opnn
        this.form.trtAppySouc = res.trt_appy_ins_d_t_o.trt_appy_souc
        this.fullscreenLoading = false
      }).catch(err => {
        this.fullscreenLoading = false
        console.log(err.data.message)
      })
      this.snryDrawer = false
    },
    // 获取弹窗内评估公司数据
    read() {
      this.fullscreenLoading = true
      axios.get('http://127.0.0.1:19995?MSG=' + this.radio4).then(res => {
        console.log('res:', res)
        this.fullscreenLoading = false
        const DllReturn = res.data.DllReturn
        if (this.radio4 === 'ReadCardBas') {
          const shbzkContent = res.data.pCardInfo
          console.log('ReadCardBas:', shbzkContent)
          if (DllReturn === '0') {
            const contentList = shbzkContent.split('|')
            this.ybrySfzh = contentList[1]
          } else {
            this.$notify({
              title: shbzkContent + '。请重新读卡',
              type: 'warning',
              duration: 2500
            })
            return
          }
        } else {
          const pOutBuff = res.data.pOutBuff
          console.log('else:', pOutBuff)
          if (DllReturn === '0') {
            this.ybrySfzh = pOutBuff.split('|')[0]
            if (this.ybrySfzh.length !== 18) {
              this.ybrySfzh = pOutBuff.split('|')[5]
            }
          } else {
            this.$notify({
              title: pOutBuff + '。请将身份证放入正确位置',
              type: 'warning',
              duration: 2500
            })
            return
          }
        }
        this.ybryQuery()
      }).catch(err => {
        this.fullscreenLoading = false
        console.log('err: {} ', err)
      })
    },
    openCostDetl(row) {
      console.log('openCostDetl row:', row)
      this.$refs.costDetl.costDetlDialog = true
      this.$refs.costDetl.INSU_ADMDVS = row.insuAdmdvs
      this.$refs.costDetl.INSUTYPE = row.insutype
      this.$refs.costDetl.PSN_NO = row.psnNo
      this.$refs.costDetl.CERT_TYPE = row.certType
      this.$refs.costDetl.CERTNO = row.certno
      this.$refs.costDetl.PSN_NAME = row.psnName
      this.$refs.costDetl.NURSCARE_WAY = row.nurscareWay
      this.$refs.costDetl.LONGTERM_EVAL_LV = row.longtermEvalLv
      this.$refs.costDetl.REG_BEGNTIME = row.begntime
      this.$refs.costDetl.LONGTERM_REG_ID = row.longtermRegId
      this.$refs.costDetl.LONGTERM_TRT_APPY_ID = row.longtermTrtAppyId
      this.$refs.costDetl.NURSCARE_PSN_NAME = row.supMedstffName
      this.$refs.costDetl.NURSCARE_PSN_NO = row.supMedstffNo
      this.$refs.costDetl.RGST_INS_ID = row.pricRgstInsId
      this.$refs.costDetl.query.pricRgstInsId = row.pricRgstInsId

      this.$refs.costDetl.crud.toQuery()
    }
  }
}
</script>

<style scoped>

</style>
